﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using Newtonsoft.Json.Linq;
using BLL;
using DAL;
using IDAL;

/***************************
 * 数据访问层
 * 楼状信息
 * Author：JXL
 ***************************/ 
namespace EstateService.Controllers
{
    public class FloorsController : ApiController
    {
        Factory<IFloor, FloorDAL> fas = new Factory<IFloor, FloorDAL>();
        // GET api/floors
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <returns></returns>
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }
        /// <summary>
        /// /获取实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("getmodel")]
       
        public Floors getmodel(int id)
        {
            string wherestr = "projectNumber=" + id + "";
            return fas.bll().getmodel<Floors>(wherestr);
        }

        // POST api/locations
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [HttpPost]
        [ActionName("insert")]
        public int insert([FromBody]Floors value)
        {
            return fas.bll().insert<Floors>(value);

        }

        // PUT api/locations/5
        /// <summary>
        /// 修改勘察记录
        /// </summary>
        /// <param name="id"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public int Put(int id, [FromBody]Floors value)
        {
            string wherestr = "projectNumber=" + id + "";

            return fas.bll().updates<Floors>(value, wherestr);
        }

        // DELETE api/floors/5
        public void Delete(int id)
        {
        }
    }
}
